package com.myexam.action;

import java.util.List;
import java.util.Map;

import org.apache.struts2.interceptor.RequestAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.myexam.model.Exam;
import com.myexam.service.TeacherService;
import com.opensymphony.xwork2.ActionSupport;
@Controller
@Scope("prototype")
public class GetExamAction extends ActionSupport implements RequestAware {

	private static final long serialVersionUID = -3562089206297749959L;
	private Map<String, Object> request;

	public Map<String, Object> getRequest() {
		return request;
	}

	public void setRequest(Map<String, Object> request) {
		this.request = request;
	}
	
	@Autowired
	private TeacherService teacherService;
	
	public String execute()throws Exception{
		List<Exam> list = teacherService.findExam();
		request.put("exams", list);
		return SUCCESS;
	}
	
}
